/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.gar.be;

//import edu.upn.sigemfi.seg.be.PersonaNatural;
import edu.upn.sigemfi.seg.be.PersonaNatural;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Programador
 */
@Entity
@Table(name = "GAR_AVAL")
@NamedQueries({

})
@PrimaryKeyJoinColumn(name = "ID_AVAL", referencedColumnName = "ID_GARANTIA")
@DiscriminatorValue(value = "AVA")
public class Aval extends Garantia implements Serializable {
    
    @Column(name = "VINCULO", length = 50)
    private String vinculo;
    @Column(name = "PROMOTOR", length = 100)
    private String promotor;
    @Basic(optional = false)
    @Column(name = "SECTORISTA", nullable = false, length = 50)
    private String sectorista;
    @Basic(optional = false)
    @Column(name = "SUPERVISOR", nullable = false, length = 50)
    private String supervisor;
    @Column(name = "ACCIONISTA")
    private Boolean accionista;

    @Column(name = "TAMAÑOEMPRESA", length = 50)
    private String tamañoempresa;

    @Column(name = "TIPOACTIVIDADECONOMICA", length = 100)
    private String tipoactividadeconomica;
    
    @Column(name = "OCUPACION", length = 50)
    private String ocupacion;

    @JoinColumn(name = "FID_SEG_PERSONA", referencedColumnName = "ID_PERSONA",  nullable = false)
    @OneToOne(fetch = FetchType.LAZY)
    private PersonaNatural personaAval;

    public Aval() {
        this.setCliente(new PersonaNatural());
        this.setPersonaAval(new PersonaNatural());
        this.setTipogarantia("Aval");
    }

    public Aval(String sectorista, String supervisor) {
        this.sectorista = sectorista;
        this.supervisor = supervisor;        
    }

    public PersonaNatural getPersonaAval() {
        return personaAval;
    }

    public void setPersonaAval(PersonaNatural personaAval) {
        this.personaAval = personaAval;
    }

    public String getVinculo() {
        return vinculo;
    }

    public void setVinculo(String vinculo) {
        this.vinculo = vinculo;
    }

    public String getPromotor() {
        return promotor;
    }

    public void setPromotor(String promotor) {
        this.promotor = promotor;
    }

    public String getSectorista() {
        return sectorista;
    }

    public void setSectorista(String sectorista) {
        this.sectorista = sectorista;
    }

    public String getSupervisor() {
        return supervisor;
    }

    public void setSupervisor(String supervisor) {
        this.supervisor = supervisor;
    }

    public Boolean getAccionista() {
        return accionista;
    }

    public void setAccionista(Boolean accionista) {
        this.accionista = accionista;
    }

    public String getTamañoempresa() {
        return tamañoempresa;
    }

    public void setTamañoempresa(String tamañoempresa) {
        this.tamañoempresa = tamañoempresa;
    }


    public String getTipoactividadeconomica() {
        return tipoactividadeconomica;
    }

    public void setTipoactividadeconomica(String tipoactividadeconomica) {
        this.tipoactividadeconomica = tipoactividadeconomica;
    }

    public String getOcupacion() {
        return ocupacion;
    }

    public void setOcupacion(String ocupacion) {
        this.ocupacion = ocupacion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idGarantia != null ? idGarantia.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Garantia)) {
            return false;
        }
        Garantia other = (Garantia) object;
        if ((this.idGarantia == null && other.idGarantia != null) || (this.idGarantia != null && !this.idGarantia.equals(other.idGarantia))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.gar.be.Garantia[idGarantia=" + idGarantia + "]";
    }

}
